package com.ywjh.inter.entity;

import java.sql.Timestamp;

import com.ywjh.inter.common.SystemConfig;
import com.ywjh.inter.utils.StrUtil;

import net.sf.json.JSONObject;

public class ProfileEntity {
	private int id;
	private int user_id;
	private String idcard;
	private String name;
	private float high;
	private float weight;
	private int disease_id;
	private String his_disease;
	private Timestamp update_time;
	private Timestamp add_time;
	private int bmi;
	private int default_address_id;
	private String memo;
	private String brithday;
	private int gender;
	private String group_disease;
	private int has_new_insulin_order;

	public String getGroup_disease() {
		return group_disease;
	}

	public void setGroup_disease(String group_disease) {
		this.group_disease = group_disease;
	}

	public String getBrithday() {
		return brithday;
	}

	public void setBrithday(String brithday) {
		this.brithday = brithday;
	}

	public int getGender() {
		return gender;
	}

	public void setGender(int gender) {
		this.gender = gender;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public int getDefault_address_id() {
		return default_address_id;
	}

	public void setDefault_address_id(int default_address_id) {
		this.default_address_id = default_address_id;
	}

	public int getBmi() {
		return bmi;
	}

	public void setBmi(int bmi) {
		this.bmi = bmi;
	}

	public Timestamp getAdd_time() {
		return add_time;
	}

	public void setAdd_time(Timestamp add_time) {
		this.add_time = add_time;
	}

	private int status;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getUser_id() {
		return user_id;
	}

	public void setUser_id(int user_id) {
		this.user_id = user_id;
	}

	public String getIdcard() {
		return idcard;
	}

	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public float getHigh() {
		return high;
	}

	public void setHigh(float high) {
		this.high = high;
	}

	public float getWeight() {
		return weight;
	}

	public void setWeight(float weight) {
		this.weight = weight;
	}

	public int getDisease_id() {
		return disease_id;
	}

	public void setDisease_id(int disease_id) {
		this.disease_id = disease_id;
	}

	public String getHis_disease() {
		return his_disease;
	}

	public void setHis_disease(String his_disease) {
		this.his_disease = his_disease;
	}

	public Timestamp getUpdate_time() {
		return update_time;
	}

	public void setUpdate_time(Timestamp update_time) {
		this.update_time = update_time;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String toJson(UsersEntity usersEntity, BindInsulinEntity insulin) {
		JSONObject d = new JSONObject();
		d.put("user_id", getUser_id());
		d.put("name", getName());
		d.put("idcard", getIdcard());
		d.put("high", getHigh());
		d.put("weight", getWeight());
		d.put("disease_id", getDisease_id());
		d.put("his_disease", getHis_disease());
		d.put("update_time", StrUtil.getYYYYMMDD(getUpdate_time()));
		d.put("add_time", StrUtil.getYYYYMMDD(getAdd_time()));
		d.put("status", getStatus());
		d.put("bmi", getBmi());
		d.put("default_address_id", getDefault_address_id());
		d.put("memo", getMemo());
		d.put("gender", getGender());
		d.put("brithday", getBrithday());
		if (usersEntity != null) {
			d.put("phone", usersEntity.getPhone());
			d.put("head_url", SystemConfig.SERVER_DOMAIN + usersEntity.getHead_url());
		}
		d.put("is_doc", 0);
		d.put("group_disease", getGroup_disease());
		if (insulin != null) {
			d.put("is_bind", 1);
			d.put("equ_mac", insulin.getEqu_mac());
			d.put("equ_name", insulin.getEqu_name());
			d.put("bind_time", StrUtil.getYYYYMMDDHHMISS(insulin.getAdd_time()));
			d.put("has_new_insulin_order", getHasNewInsulinOrder());
		} else {
			d.put("is_bind", 0);
		}
		return d.toString();
	}

	public void setHasNewInsulinOrder(int has_new_insulin_order) {
		this.has_new_insulin_order = has_new_insulin_order;
	}

	public int getHasNewInsulinOrder() {
		return this.has_new_insulin_order;
	}

}
